<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      https://leetcode-cn.com/problems/merge-two-binary-trees/
      思路：https://leetcode-cn.com/problems/merge-two-binary-trees/solution/shou-hua-tu-jie-by-xiao_ben_zhu-3/
     */
    function mergeTrees(t1, t2) {
      if (!t1 && t2) {
        return t2;
      }
      if (t1 && !t2 || !t1 && !t2) {
        return t1;
      }
      t1.val += t2.val;

      t1.left = mergeTrees(t1.left, t2.left);
      t1.right = mergeTrees(t1.right, t2.right);

      return t1;
    }
  </script>
</body>
</html>